home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 16720 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  873 b 

  1. Path: mail2news.demon.co.uk!txwang
  2. From: Wang TianXing <gztxwang@public1.guangzhou.gd.cn>
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: fastest code
  5. Date: Fri, 12 Apr 1996 06:25:32 GMT
  6. Message-ID: <199604120625.OAA23465@public1.guangzhou.gd.cn>
  7. X-NNTP-Posting-Host: txwang
  8. X-Newsreader: Forte Free Agent 1.0.82
  9. X-Mail2News-Path: public1.guangzhou.gd.cn!txwang
  10.  
  11. I wrote:
  12. > Someone wrote:
  13. >
  14. > | void test(int& x) {
  15. > |   if (!(x==0))
  16. > |     x=x+1;
  17. > |   }
  18.  
  19. > I'd prefer a compiler that could generate:
  20.  
  21. > test@i:
  22. >   cmp [eax], 1
  23. >   sbb [eax], -1
  24. >   ret
  25.  
  26. I would NOT prefer that one!  That I prefer is that can generate
  27. something similar to:
  28.  
  29. test@i:
  30.   cmp dword ptr [eax], 1
  31.   sbb dword ptr [eax], -1
  32.   ret
  33.  
  34. You've got the idea.  Some of Microsoft's seem to do some similar
  35. things to intrinsic functions.  Which compilers can do this to my own
  36. functions? :)
  37.  
  38. --
  39. Wang TianXing
  40.  
  41.  
  42.